package com.example.weathersuggestion;

import java.util.*;

public class ClothingSuggestion extends Suggestion{
	
	private List<String> clothingList;
	private ArrayList<String> returnedList = new ArrayList<String>();
	
	
	public ClothingSuggestion(){
		
		//index relates to temperature, i.e. index (0) is temp 0-10F and so on...
		clothingList = new ArrayList<String>();
		clothingList.add(0,"Heavy Jacket, Scarf, Long Sleeve Shirt, Pants, Gloves, Hat");
		clothingList.add(1,"Heavy Jacket, Scarf, Long Sleeve Shirt, Pants, Gloves, Hat");
		clothingList.add(2,"Heavy Jacket, Scarf, Long Sleeve Shirt, Pants, Gloves, Hat");
		clothingList.add(3,"Heavy Jacket, Long Sleeve Shirt, Pants, Gloves, Hat");
		clothingList.add(4,"Jacket, Long Sleeve Shirt, Pants, Gloves");
		clothingList.add(5,"Jacket, Long Sleeve Shirt, Pants");
		clothingList.add(6,"Light Jacket, Short Sleeve Shirt, Pants/Shorts");
		clothingList.add(7,"Short Sleeve Shirt, Shorts, Flip Flops");
		clothingList.add(8,"Short Sleeve Shirt, Shorts, Flip Flops");
		clothingList.add(9,"Short Sleeve Shirt, Shorts");
		clothingList.add(10,"Short Sleeve Shirt, Shorts");
		clothingList.add(11,"Goose Down Jacket, Scarf, Long Sleeve Shirt, Pants, Thermals, Hat, Boots");
		clothingList.add(12,"Goose Down Jacket, Scarf, Long Sleeve Shirt, Overalls, Gloves, Hat, Boots");
		clothingList.add(13,"Fleece Jacket, Scarf, Long Sleeve Shirt, Pants, Gloves, Hat, Boots");
		clothingList.add(14,"Fleece Jacket, Turtle Neck Sweater, Jeans, Gloves, Hat");
		clothingList.add(15,"Jacket, Sweatshirt, Sweatpants, Tennis Shoes");
		clothingList.add(16,"Jacket, Sweatshirt, Sweatpants, Tennis shoes");
		clothingList.add(17,"Light Jacket, Short Sleeve Shirt, Shorts, Sandals");
		clothingList.add(18,"Short Sleeve Shirt, Shorts, Sandals");
		clothingList.add(19,"Short Sleeve Shirt, Shorts, Flip Flops");
		clothingList.add(20,"Tank top, Shorts, Flip Flops, Sunglasses, Wide Brimmed Hat");
		clothingList.add(21,"Tank top, Shorts, Flip Flops, Sunglasses, Wide Brimmed Hat, Sunblock");
	}
	
	
	@Override
	public ArrayList<String> getSuggestion(Double currentTemp, Double precipValue) {
		returnedList = new ArrayList<String>();
		double precipPercent;
		//long longTemp;
		int index=-1; //default
		
		//handle strings
		setTemp((currentTemp));
		precipPercent = precipValue;
		int temp_int = currentTemp.intValue();
		index = (int)(temp_int*.1);
		//convert precipitation from double percentage to boolean (yes/no)
		if(precipPercent < 50 && precipPercent >= 0){
			setPrecip(false);
		}
		else if(precipPercent >= 50 && precipPercent <= 100){
			setPrecip(true);
		}
		else{
			//return "Precipitation can't be resolved to boolean. Out of bounds (0-100)\nPercent val passed: " + precipPercent;
		}
		
		Random generator = new Random();//Generate a 0 or 1
		int randomIndex = generator.nextInt( 2 );
		
		if(randomIndex == 1)//if 1 is generated add 11 to index
		{
			index += 11;
		}
		//find suggestions if precipitation is likely
		if(!(getPrecip())){
			returnedList.add(clothingList.get(index));
		}
		else{
			returnedList.add(clothingList.get(index)+"\nBe aware of precipitation");			
		}
		return returnedList;


	}





}
